home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / qwik41.arc / QINITEST.PAS < prev    next >
Pascal/Delphi Source File  |  1989-06-12  |  6KB  |  184 lines

  1. { Qinitest.pas - tests your system configuration            ver 4.1, 05-01-88 }
  2.  
  3. program Qinitest;
  4.  
  5. uses
  6.   Crt, Qwik;
  7.  
  8. type
  9.   Str9  = string[ 9];
  10.   Str33 = string[33];
  11.  
  12. var
  13.   CursorMode:     word absolute $0040:$0060;
  14.   b,OldVideoMode: byte;
  15.   Strng:          string;
  16.   Ch:             char;
  17.  
  18. { -- Converts any number into a Binary character string -- }
  19. function DecToBin (Number: longint; Bits: byte): str33;
  20. const
  21.   D2B: array[0..1] of char = '01';
  22. var
  23.   BinStr: Str33;
  24.   Bit:    byte;
  25. begin
  26.   BinStr:='b';
  27.   for Bit:=0 to pred(Bits) do
  28.     BinStr:=D2B[(Number shr Bit) and 1] + BinStr;
  29.   DecToBin:=BinStr;
  30. end;
  31.  
  32. { -- Converts any number into a Hex character string -- }
  33. function DecToHex (Number: longint; HexChars: byte): str9;
  34. const
  35.   D2H: array[0..$F] of char = '0123456789ABCDEF';
  36. var
  37.   HexStr:       Str9;
  38.   HexChar,Bits: byte;
  39. begin
  40.   HexStr:='';
  41.   for HexChar:=0 to pred(HexChars) do
  42.     begin
  43.       Bits:=HexChar shl 2;
  44.       HexStr:=D2H[(Number shr Bits) and $F] + HexStr;
  45.     end;
  46.   DecToHex:='$' + HexStr;
  47. end;
  48.  
  49. procedure DisplayDev (DD: byte);
  50. begin
  51.   case DD of
  52.     $00: Strng:='No display';
  53.     $01: Strng:='MDA with 5151 monochrome';
  54.     $02: Strng:='CGA with 5153/4 color';
  55.     $04: Strng:='EGA with 5153/4 color';
  56.     $05: Strng:='EGA with 5151 monochrome';
  57.     $06: Strng:='PGC with 5175 color';
  58.     $07: Strng:='VGA with analog monochrome';
  59.     $08: Strng:='VGA with analog color';
  60.     $0B: Strng:='MCGA with analog monochrome';
  61.     $0C: Strng:='MCGA with analog color';
  62.   else Strng:='Reserved';
  63.   end; { case }
  64. end;
  65.  
  66. begin
  67.   OldVideoMode:=VideoMode;
  68.   NormVideo;
  69.   Qfill (1,1,CRTrows,CRTcols,TextAttr,' ');
  70.   Qwrite (1,1,-1,'Which text mode [0,1,2,3,7] ? ');
  71.   GotoRC (1,31);
  72.   repeat
  73.     Ch:=readkey;
  74.   until Ch in ['0'..'3','7'];
  75.   b:=ord(Ch)-ord('0');
  76.   if b<>OldVideoMode then
  77.     begin
  78.       TextMode(b);
  79.       Qinit;
  80.     end;
  81.   CheckSnow:=Qsnow;
  82.   Qfill (1,1,25,CRTcols,TextAttr,' ');
  83.   GotoRC (1,1);
  84.   case CpuID of
  85.     Cpu8086:  Strng:='Intel 8086/88';
  86.     Cpu80186: Strng:='Intel 80186/188';
  87.     Cpu80286: Strng:='Intel 80286';
  88.     Cpu80386: Strng:='Intel 80386';
  89.   end;
  90.   writeln ('CPU ident         = ',Strng);
  91.   case SystemID of
  92.     $FF: Strng:='IBM PC';
  93.     $FE: Strng:='IBM PC XT';
  94.     $FD: Strng:='IBM PCjr';
  95.     $FC: case SubModelID of
  96.            $00: Strng:='IBM PC AT (6 MHz)';
  97.            $01: Strng:='IBM PC AT (8 MHz)';
  98.            $02: Strng:='IBM PC XT (286)';
  99.            $04: Strng:='IBM PS/2 Model 50';
  100.            $05: Strng:='IBM PS/2 Model 60';
  101.          else   Strng:='IBM PS/2 VGA type';
  102.          end;
  103.     $FB: Strng:='IBM PC XT (256/640)';
  104.     $FA: case SubModelID of
  105.            $00: Strng:='IBM PS/2 Model 30';
  106.            $01: Strng:='IBM PS/2 Model 25';
  107.          else   Strng:='IBM PS/2 MCGA type';
  108.          end;
  109.     $F9: Strng:='IBM PC convertible';
  110.     $F8: case SubModelID of
  111.            $00: Strng:='IBM PS/2 Model 80 (16 MHz)';
  112.            $01: Strng:='IBM PS/2 Model 80 (20 MHz)';
  113.          else   Strng:='IBM PS/2 Model 70/80 type';
  114.          end;
  115.   else Strng:='Unknown, not an IBM';
  116.   end;  { case }
  117.   writeln ('System ID         = ',DecToHex(SystemID,2));
  118.   writeln ('SubModel ID       = ',SubModelID);
  119.   writeln ('  ',Strng);
  120.   writeln ('Have PS/2 video   = ',HavePS2);
  121.   writeln ('IBM 3270 PC       = ',Have3270);
  122.   writeln ('Prior video mode  = ',OldVideoMode);
  123.   writeln ('Video mode now    = ',VideoMode);
  124.   writeln ('Wait-for-retrace  = ',Qsnow);
  125.   writeln ('Max page #        = ',MaxPage);
  126.  
  127.   if Have3270 then
  128.     begin
  129.       writeln ('Disp Dev 3270     = ',DecToHex(ActiveDispDev3270,2));
  130.       case ActiveDispDev3270 of
  131.         $00: Strng:='5151 or 5272 display and adapter';
  132.         $01: Strng:='3295 display and adapter';
  133.         $02: Strng:='5151 or 5272, adapter, XGA graphics';
  134.         $03: Strng:='5279 display, 3270 PC G adapter';
  135.         $04: Strng:='5379 C01 display, 3270 PC GX adapter';
  136.         $05: Strng:='5379 M01 display, 3270 PC GX adapter';
  137.         $FF: Strng:='Unknown, not a 3270 PC';
  138.       else Strng:='Reserved';
  139.       end;
  140.       writeln ('  ',Strng);
  141.     end
  142.   else
  143.     begin
  144.       DisplayDev (ActiveDispDev);
  145.       writeln ('Active Disp Dev   = ',DecToHex(ActiveDispDev,2));
  146.       writeln ('  ',Strng);
  147.  
  148.       if SystemID=$F9 then
  149.         writeln ('Alt Disp Dev PC Conv = ',DecToHex(AltDispDevPCC,4))
  150.       else
  151.         begin
  152.           DisplayDev (AltDispDev);
  153.           writeln ('Alt Disp Dev      = ',DecToHex(AltDispDev,2));
  154.           writeln ('  ',Strng);
  155.         end;
  156.  
  157.       writeln ('Hercules model    = ',HercModel);
  158.       case HercModel of
  159.         0: Strng:='No Hercules card';
  160.         1: Strng:='Hercules Graphics Card';
  161.         2: Strng:='Hercules Graphics Card Plus';
  162.         3: Strng:='Hercules InColor Card';
  163.       end;
  164.       writeln ('  ',Strng);
  165.     end;
  166.  
  167.   writeln ('Cursor start      = ',DecToHex(hi(CursorMode),2));
  168.   writeln ('Cursor end        = ',DecToHex(lo(CursorMode),2));
  169.   writeln ('CRT rows          = ',CRTrows);
  170.   writeln ('CRT columns       = ',CRTcols);
  171.   if (ActiveDispDev>=EgaColor) and (ActiveDispDev<=McgaColor) then
  172.     begin
  173.       writeln ('EGA rows          = ',EgaRows);
  174.       writeln ('EGA FontSize      = ',EgaFontSize);
  175.       writeln ('EGA Info          = ',DecToBin(EgaInfo,8));
  176.       writeln ('EGA Switches      = ',DecToBin(EgaSwitches,8));
  177.     end;
  178.   write ('Press any key...');
  179.   repeat
  180.     Ch:=ReadKey;
  181.   until not KeyPressed;
  182.   TextMode (OldVideoMode);
  183. end.
  184.